package problem238_Product_of_Array_Except_Self;

public class Solution {
	 public int[] productExceptSelf(int[] nums) {
		 int[] result=new int[nums.length];
		 result[nums.length-1]=1;
		 for(int i=nums.length-2;i>=0;i--){
			 result[i]=nums[i+1]*result[i+1];
		 }
		 int left=1;
		 for(int i=0;i<nums.length;i++){
			 result[i]=left*result[i];
			 left*=nums[i];
		 }
		 return result;
	 }
}
